package reflect;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 牌的排序
 */
class Pai implements Comparable<Pai> {
	int num; // 牌面数字
	String type; // 花色  012
	
	public Pai(int num, String type) {
		super();
		this.num = num;
		this.type = type;
	}
	
	@Override
	public int compareTo(Pai o) { 
		return o.num-this.num;
	}
	
	public String toString() {
		return  num+type;
	}
	
}

public class Test9 {
    /*
		   1-9万  *4=36
		   1-9桶  *4=36	
		   1-9条  *4=36
		         得到108张牌
		         洗牌
		         发给4个人（只发13张）
		         排序打印出来
     */
	public static void main(String[] args) {
		
		List list =new ArrayList(); //放所有牌
        
        for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <=4; j++) {				  
				list.add(new Pai(i, "桶"));
				list.add(new Pai(i, "条"));
				list.add(new Pai(i, "万"));
			}
		}
		
        Collections.sort(list);
        System.out.println(list);

	}

}
